/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.team3309.beta.commands;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.command.Command;
import org.team3309.beta.OI;
import org.team3309.beta.subsystems.Arm;

/**
 *
 * @author Vincente
 */
public class JoystickArm extends Command {

    private Joystick stick = null;
    private Arm arm = Arm.getInstance();

    public JoystickArm(int id) {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(arm);
        stick = OI.getInstance().getJoystick(id);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        arm.setPercentVbus(stick.getY());
        if(stick.getRawButton(2))
            arm.openGripper();
        if(!stick.getRawButton(2))
            arm.closeGripper();
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return false;
    }

    // Called once after isFinished returns true
    protected void end() {
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}